#ifndef _VN_RECT_H_
#define _VN_RECT_H_

namespace vn
{
	class IntRect
	{
	public:
		IntRect(int p_x = 0, int p_y = 0, int p_w = 0, int p_h = 0) { x = p_x; y = p_y; w = p_w; h = p_h; }
		//IntRect(vn::FloatRect& p_floatRect) { x = static_cast<int>(p_floatRect.x); y = static_cast<int>(p_floatRect.y); w = static_cast<int>(p_floatRect.w); h = static_cast<int>(p_floatRect.h); }
		virtual ~IntRect(){}

		bool intersect(const vn::IntRect& p_intRect)
		{
			if (p_intRect.x >= (x + w)) return false;
			if ((p_intRect.x + p_intRect.w) <= x) return false;
			if (p_intRect.y >= (y + h)) return false;
			if ((p_intRect.y + p_intRect.h) <= y) return false;
			return true;
		}

		int x;
		int y;
		int w;
		int h;
	};

	class FloatRect
	{
	public:
		FloatRect(float p_x = 0.0f, float p_y = 0.0f, float p_w = 0.0f, float p_h = 0.0f) { x = p_x; y = p_y; w = p_w; h = p_h; }
		FloatRect(vn::IntRect& p_intRect) { x = static_cast<float>(p_intRect.x); y = static_cast<float>(p_intRect.y); w = static_cast<float>(p_intRect.w); h = static_cast<float>(p_intRect.h); }
		virtual ~FloatRect(){}
		
		bool intersect(const vn::FloatRect& p_floatRect)
		{
			if (p_floatRect.x >= (x + w)) return false;
			if ((p_floatRect.x + p_floatRect.w) <= x) return false;
			if (p_floatRect.y >= (y + h)) return false;
			if ((p_floatRect.y + p_floatRect.h) <= y) return false;
			return true;
		}
		
		float x;
		float y;
		float w;
		float h;
	};
}

#endif // _VN_RECT_H_